# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Gaetan Bisson <bisson@archlinux.org>
# Contributor: Vesa Kaihlavirta <vesa@archlinux.org>
# Contributor: Roman Cheplyaka <roma@ro-che.info>

pkgname=libedit
_pkgver=20230828-3.1
pkgver=${_pkgver/-/_}
pkgrel=1
pkgdesc='Command line editor library providing generic line editing, history, and tokenization functions'
url='https://thrysoee.dk/editline/'
arch=('loong64' 'x86_64')
license=('BSD')
depends=('glibc' 'ncurses' 'libncursesw.so')
provides=('libedit.so')
source=(${url}/${pkgname}-${_pkgver}.tar.gz)
sha256sums=('4ee8182b6e569290e7d1f44f0f78dac8716b35f656b76528f699c69c98814dad')
b2sums=('bb54593e0d9b92c09027edf3f2ca25631d8684ad9dd6359744ad3b1121b16e2e9bc4e4dbf1d02524ed0605ccaab2564c115adb6da338984e831433a9af4c7cb9')

build() {
  cd ${pkgname}-${_pkgver}
  ./configure --prefix=/usr
  make V=1
}

package() {
  cd ${pkgname}-${_pkgver}
  make DESTDIR="${pkgdir}" install

  rm "${pkgdir}"/usr/share/man/man3/history.3 # conflicts with readline
  install -Dm 644 "${pkgdir}"/usr/share/man/man3/editline.3 "${pkgdir}"/usr/share/man/man3/el.3

  install -Dm 644 ChangeLog -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 COPYING -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim:set sw=2 sts=-1 et:
